home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Devices and Hardware / ADB / ModifyMouseAccl / CrsrDev.h next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  2.7 KB  |  88 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        CrsrDev.h
  3.     
  4.     Description:
  5.  
  6.     Author:        RK
  7.  
  8.     Copyright:     Copyright: © 1999 by Apple Computer, Inc.
  9.                 all rights reserved.
  10.     
  11.     Disclaimer:    You may incorporate this sample code into your applications without
  12.                 restriction, though the sample code has been provided "AS IS" and the
  13.                 responsibility for its operation is 100% yours.  However, what you are
  14.                 not permitted to do is to redistribute the source as "DSC Sample Code"
  15.                 after having made changes. If you're going to re-distribute the source,
  16.                 we require that you make it clear in the source that the code was
  17.                 descended from Apple Sample Code, but that you've made changes.
  18.     
  19.     Change History (most recent first):
  20.  
  21. */
  22.  
  23. #include <Types.h>
  24. #include <fixmath.h>
  25.  
  26. struct AcclPoint    {
  27.     Fixed        deviceSpeed;
  28.     Fixed        cursorSpeed;
  29. };
  30.  
  31. typedef struct AcclPoint AcclPoint;
  32.  
  33. struct AcclTable    {
  34.     Fixed        accel;
  35.     short        numAcclPoints;
  36.     AcclPoint    acclPoints[1];    
  37. };
  38.  
  39. typedef struct AcclTable AcclTable;
  40. typedef AcclTable *AcclTablePtr;
  41.  
  42. struct AcclRsrcType {
  43.     UInt32            acclClass;
  44.     short            numAcclTables;
  45.     AcclTable        acclTable[1];
  46. };
  47.  
  48. typedef struct AcclRsrcType AcclRsrcType;
  49. typedef AcclRsrcType *AcclRsrcPtr, **AcclRsrcHandle;
  50.  
  51. struct AccelPointRec {
  52.     Fixed    devSpeed;        // device speed
  53.     Fixed    slope;
  54.     Fixed    intercept;
  55. };
  56.  
  57. typedef struct AccelPointRec     AccelPointRec;
  58. typedef AccelPointRec            AccelPointArray[1];
  59. typedef AccelPointArray            *AccelPointArrPtr;
  60.  
  61. struct MyCursorDevice {
  62.     struct CursorDevice        *nextCursorDevice;            /* pointer to next record in linked list */
  63.     CursorData                *whichCursor;                /* pointer to data for target cursor */
  64.     long                    refCon;                        /* application-defined */
  65.     long                    unused;                        /* reserved for future */
  66.     OSType                    devID;                        /* device identifier (from ADB reg 1) */
  67.     Fixed                    resolution;                    /* units/inch (orig. from ADB reg 1) */
  68.     UInt8                    devClass;                    /* device class (from ADB reg 1) */
  69.     UInt8                    cntButtons;                    /* number of buttons (from ADB reg 1) */
  70.     UInt8                    filler1;                    /* reserved for future */
  71.     UInt8                    buttons;                    /* state of all buttons */
  72.     UInt8                    buttonOp[8];                /* action performed per button */
  73.     unsigned long            buttonTicks[8];                /* ticks when button last went up (for debounce) */
  74.     long                    buttonData[8];                /* data for the button operation */
  75.     unsigned long            doubleClickTime;            /* device-specific double click speed */
  76.     Fixed                    acceleration;                /* current acceleration */
  77.     AccelPointArrPtr        accelPointArrPtr;            /* fields used internally to CDM */
  78.     Fixed                    deltaX;                    
  79.     Fixed                    deltaY;                    
  80.     Fixed                    errorX;                    
  81.     Fixed                    errorY;    
  82.     Fixed                    denom;
  83.     Fixed                    spread;
  84.     UInt8                    newData;
  85.     UInt8                    filler2;            
  86. };
  87. typedef struct MyCursorDevice MyCursorDevice, *MyCursorDevicePtr;
  88.